import { defineStore } from 'pinia';

// 定义一个名为 useAppStore 的 Pinia store
export const useAppStore = defineStore('app', {
  // 定义 store 的 state
  state: () => ({
    user: {
      userInfo: null,
      token: null
    },
    setting: {
      collapse: false,
      fullScreen: false
    }
  }),
  // 定义 store 的 getters
  getters: {
    // 获取用户信息
    userInfo: (state) => state.user.userInfo,
    // 获取 token
    token: (state) => state.user.token,
    // 获取侧边栏折叠状态
    collapse: (state) => state.setting.collapse,
    // 获取全屏状态
    fullScreen: (state) => state.setting.fullScreen
  }
});